<template>
    <div class="weather" style="padding: 10px">
        <div>
            <h4>{{ Locations_info }}</h4>
            <h6>——我不是在旅行，就是在旅行的路上</h6>
        </div>
        <div class="cell_dashed"></div>
        <van-cell v-for='(item, index) in weather_report_list' :key="index" style="height: 50px">
            <div style="width:30%; text-align:center; float:left; line-height: 30px">
                星期{{ item.week }}
            </div>
            <div style="width:30%; text-align:center; float:left; line-height: 30px">
                {{ item.dayweather }}转{{ item.nightweather }}
            </div>
            <div style="width:40%; text-align:center; float:left; line-height: 30px">
                白天{{ item.daytemp }} 夜晚{{ item.nighttemp }}
            </div>
            <hr />
        </van-cell>
    </div>
</template>

<script>
// import Vue from 'vue'
// import { List } from 'vant';
// import 'vant/lib/list/style'

// Vue.use(List);
// import "http://pv.sohu.com/cityjson?ie=utf-8"
    
    export default {
        data () {
            return{
                Locations_info: "正在定位所在省",
                weather_report_list: [],
            }  
        },
        mounted: function(){
            console.log(localStorage.getItem('userstatus')) // 如果登录了，这里就会获取到ok，否则会是null
            if (JSON.parse(localStorage.getItem('userstatus')) != 'login'){
                this.$router.push({path:'/no_login/'})
            }
            else{
                // console.log(returnCitySN.cname);
                // console.log(JSON.stringify(returnCitySN));
                this.city()
                console.log(localStorage.getItem('Ip'))
            }
        },
        methods:{
            city() {
                this.$axios.get("get_data/weather/", {
                    params:{
                        "ip":localStorage.getItem('Ip'),
                    }
                }).then(res=>{
                    // console.log(res.data)
                    this.Locations_info = res.data['data']["locations_info"]
                    this.weather_report_list = res.data['data']["weather"]
                })
            }
        }
    }
</script>

<style>
@import "../../assets/themes/css/go-css.css";
.slide{
    margin-bottom: 23px;
}



</style>
